const express = require('express');
const router = express.Router();
const { authenticateToken } = require('../middleware/auth');
const { validateRegister, validateLogin } = require('../middleware/validation');
const {
  register,
  login,
  getCurrentUser,
  updateUser,
  changePassword
} = require('../controllers/authController');

// 公开路由
router.post('/register', validateRegister, register);
router.post('/login', validateLogin, login);

// 需要认证的路由
router.get('/me', authenticateToken, getCurrentUser);
router.put('/profile', authenticateToken, updateUser);
router.put('/change-password', authenticateToken, changePassword);

module.exports = router; 